PDI Register definition

PDI register doc generation

Can be used to generate the wiki page table WpWiki-Doc


In [1]:
# bitdefs - elements for bit descriptions
# bitsz - size of register in bits
# 
def reg_wiki(reg_name, reg_dir, reg_description, bitdefs, bitsz):
 
  reg_size = str(bitsz)+"bit"

  # part table definitions 
  #table pre part of row
  title_pre_row = "^ ^ Register ^ Direction ^ Size ^ Description "
  reg_pre_row   = "| {0} | {1} | {2} | {3} | {4} ".format('', reg_name, reg_dir, reg_size, reg_description)
  bit_pre_row   = "| ::: | ::: | ::: | ::: | ::: "
  #table post part of row
  title_post_row = "^ Bit ^ Name ^ Hex ^ Bit Description ^"
  bit_post_row   = "| ''[{0:2}]'' |{2:19}  | 0x{1:08X} | {3:30} |"  # define a sub-row for bit description with parameter 0-3

  print("=== "+reg_name+" definition ===")
  print(title_pre_row + title_post_row)
  for i in range(nbr):
    desc = [0, '', '']  # empty element
    for k in bitdefs:
      if k[0] == i:
        desc = k
    if not desc[1] == '':
      if i == 0:
        print(reg_pre_row + bit_post_row.format(i,1<<i,desc[1],desc[2]))  # for first line add register description
      else:
        print(bit_pre_row + bit_post_row.format(i,1<<i,desc[1],desc[2]))  # for other liens add column concat


  """# use full row definitions for printing
  tabtitle = "^ ^ Register ^ Direction ^ Size ^ Description ^ Bit ^ Name ^ Hex ^ Bit Description ^"
  reg_row = "| {0} | {1} | {2} | {3} | {4} |             |        |         |        |".format('', reg_name, reg_dir, reg_size, reg_description)
  bit_row = "| ::: | ::: | ::: | ::: | ::: | ''[{0:2}]'' |{2:19}  | {1:08X} | {3:30} |"  # define a row for bit description with parameter 0-3

  print("==== ControlWord definition ====")
  print(tabtitle)
  print(reg_row)
  for i in range(nbr):
    desc = [0, '', '']
    for k in register:
      if k[0] == i:
        desc = k
    print(bit_row.format(i,1<<i,desc[1],desc[2]))"""

In [2]:
# print the register information as text (full)
def reg_text(register, nbr):
  print("^ bit  ^                           Binary ^ Hex      ^   Decimal  ^    bit    ^ Register name   ^ Comment ^")
  print("|------|----------------------------------|----------|------------|-----------|-----------------|-----------------|")
  for i in range(nbr):
    desc = [0, '', '']
    for k in register:
      if k[0] == i:
        desc = k
    print("|{0:4} | {1:032b} | {1:08X} | {1:10d} | ''[{0:3}]'' | {2:22} | {3:30} |".format(i,1<<i,desc[1],desc[2]))

Control Word Register


In [3]:
nbr = 32

register =  ([  0 , 'CMD_PREPARE'       , '-'],)
register += ([  1 , 'CMD_START'         , '-'],)
register += ([  2 , 'CMD_STOP'          , '-'],)
register += ([  3 , 'CMD_ABORT'         , '-'],)
register += ([  4 , 'CMD_SYNC'          , '-'],)
register += ([  5 , 'CMD_FINISH'        , '-'],)
register += ([  6 , 'CMD_PAUSE'         , '-'],)
register += ([  7 , 'CMD_TRANSFER_ABORT', '-'],)
register += ([  8 , 'CMD_RESTART'       , '-'],)
register += ([ 16 , 'CMD_INLET_VALVE'   , '-'],)
register += ([ 17 , 'CMD_OUTLET_VALVE'  , '-'],)
register += ([ 18 , 'CMD_FIRE_VOLTAGE'  , '-'],)
register += ([ 19 , 'CMD_PH_HEATER'     , '-'],)
register += ([ 24 , 'CMD_MANUAL_FIRE'   , '-'],)
register += ([ 25 , 'CMD_MANUAL_DATA'   , '-'],)
register += ([ 28 , 'CMD_PH_SELECT1'    , '-'],)
register += ([ 29 , 'CMD_PH_SELECT2'    , '-'],)
register += ([ 30 , 'CMD_PH_SELECT3'    , '-'],)
register += ([ 31 , 'CMD_PH_SELECT4'    , '-'],)


reg_wiki("ControlWord", "Input", "PDI ControlWord", register, nbr)

#print("\n")
#print("... and in text format")
#reg_text("ControlWord", "Input", "PDI ControlWord", register, nbr)


=== ControlWord definition ===
^ ^ Register ^ Direction ^ Size ^ Description ^ Bit ^ Name ^ Hex ^ Bit Description ^
|  | ControlWord | Input | 32bit | PDI ControlWord | ''[ 0]'' |CMD_PREPARE          | 0x00000001 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 1]'' |CMD_START            | 0x00000002 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 2]'' |CMD_STOP             | 0x00000004 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 3]'' |CMD_ABORT            | 0x00000008 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 4]'' |CMD_SYNC             | 0x00000010 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 5]'' |CMD_FINISH           | 0x00000020 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 6]'' |CMD_PAUSE            | 0x00000040 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 7]'' |CMD_TRANSFER_ABORT   | 0x00000080 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 8]'' |CMD_RESTART          | 0x00000100 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[16]'' |CMD_INLET_VALVE      | 0x00010000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[17]'' |CMD_OUTLET_VALVE     | 0x00020000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[18]'' |CMD_FIRE_VOLTAGE     | 0x00040000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[19]'' |CMD_PH_HEATER        | 0x00080000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[24]'' |CMD_MANUAL_FIRE      | 0x01000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[25]'' |CMD_MANUAL_DATA      | 0x02000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[28]'' |CMD_PH_SELECT1       | 0x10000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[29]'' |CMD_PH_SELECT2       | 0x20000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[30]'' |CMD_PH_SELECT3       | 0x40000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[31]'' |CMD_PH_SELECT4       | 0x80000000 | -                              |

Status Word Register


In [5]:
nbr = 32

# =====================================================================
register =  ([  0, 'STATUS_ERROR'          , '-'],)
register += ([  1, 'STATUS_1'              , '-'],)
register += ([  2, 'STATUS_2'              , '-'],)
register += ([  3, 'STATUS_3'              , '-'],)
register += ([  4, 'STATUS_IDLE'           , 'PrintControl StateMachine - IDLE'],)
register += ([  5, 'STATUS_PREPARING'      , 'PrintControl StateMachine - PREPARING'],)
register += ([  6, 'STATUS_READY'          , 'PrintControl StateMachine - READY'],)
register += ([  7, 'STATUS_PRINTING'       , 'PrintControl StateMachine - PRINTING'],)
register += ([  8, 'STATUS_DONE'           , 'PrintControl StateMachine - DONE'],)
register += ([ 12, 'STATUS_MOVING'         , 'interpolator/pulsegenerator'],)
register += ([ 13, 'STATUS_SYNC_WARNING'   , 'interpolator/pulsegenerator'],)
register += ([ 14, 'STATUS_BUSY'           , 'interpolator/pulsegenerator busy flag, one ph is printing (generating pulses) \\ [[http://wpwiki/doku.php?id=internal:vhdl:components:interpolator:vhdl&#pulsegeneratorvhd]]'],)
register += ([ 15, 'STATUS_ACTIVE'         , 'interpolator/pulsegenerator active flag, on ph is started (received start signal) \\ [[http://wpwiki/doku.php?id=internal:vhdl:components:interpolator:vhdl&#pulsegeneratorvhd]]'],)
register += ([ 16, 'STATUS_PH_PRESENT'     , 'Printhead is present for all connected HIB'],)
register += ([ 17, 'STATUS_PH_WARNING'     , 'Warning or Error for one PH is present'],)
register += ([ 18, 'STATUS_PH_WAVEFORM'    , '[Ricoh only] printhead waveform load request'],)
register += ([ 19, 'STATUS_PH_TEMPERATURE' , 'Temperature of one PH is not ok'],)
register += ([ 20, 'STATUS_IMAGEEND'       , 'jetmapping - image print end event'],)
register += ([ 21, 'STATUS_LINK_LOSS'      , 'HIB link loss indication on one enabled ph [HIB products only]'],)
register += ([ 24, 'STATUS_JOBQUEUEEMPTY'  , '-'],)
register += ([ 25, 'STATUS_JOBTRANSFER'    , '-'],)
register += ([ 28, 'STATUS_STEPPERMOTOR_BUSY'  , '[Kyocera only]'],)

reg_wiki("StatusWord", "Output", "PDI StatusWord", register, nbr)

#print("\n")
#print("... and in text format")
#reg_text("ControlWord", "Input", "PDI ControlWord", register, nbr)


=== StatusWord definition ===
^ ^ Register ^ Direction ^ Size ^ Description ^ Bit ^ Name ^ Hex ^ Bit Description ^
|  | StatusWord | Output | 32bit | PDI StatusWord | ''[ 0]'' |STATUS_ERROR         | 0x00000001 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 1]'' |STATUS_1             | 0x00000002 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 2]'' |STATUS_2             | 0x00000004 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 3]'' |STATUS_3             | 0x00000008 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[ 4]'' |STATUS_IDLE          | 0x00000010 | PrintControl StateMachine - IDLE |
| ::: | ::: | ::: | ::: | ::: | ''[ 5]'' |STATUS_PREPARING     | 0x00000020 | PrintControl StateMachine - PREPARING |
| ::: | ::: | ::: | ::: | ::: | ''[ 6]'' |STATUS_READY         | 0x00000040 | PrintControl StateMachine - READY |
| ::: | ::: | ::: | ::: | ::: | ''[ 7]'' |STATUS_PRINTING      | 0x00000080 | PrintControl StateMachine - PRINTING |
| ::: | ::: | ::: | ::: | ::: | ''[ 8]'' |STATUS_DONE          | 0x00000100 | PrintControl StateMachine - DONE |
| ::: | ::: | ::: | ::: | ::: | ''[12]'' |STATUS_MOVING        | 0x00001000 | interpolator/pulsegenerator    |
| ::: | ::: | ::: | ::: | ::: | ''[13]'' |STATUS_SYNC_WARNING  | 0x00002000 | interpolator/pulsegenerator    |
| ::: | ::: | ::: | ::: | ::: | ''[14]'' |STATUS_BUSY          | 0x00004000 | interpolator/pulsegenerator busy flag, one ph is printing (generating pulses) \ [[http://wpwiki/doku.php?id=internal:vhdl:components:interpolator:vhdl&#pulsegeneratorvhd]] |
| ::: | ::: | ::: | ::: | ::: | ''[15]'' |STATUS_ACTIVE        | 0x00008000 | interpolator/pulsegenerator active flag, on ph is started (received start signal) \ [[http://wpwiki/doku.php?id=internal:vhdl:components:interpolator:vhdl&#pulsegeneratorvhd]] |
| ::: | ::: | ::: | ::: | ::: | ''[16]'' |STATUS_PH_PRESENT    | 0x00010000 | Printhead is present for all connected HIB |
| ::: | ::: | ::: | ::: | ::: | ''[17]'' |STATUS_PH_WARNING    | 0x00020000 | Warning or Error for one PH is present |
| ::: | ::: | ::: | ::: | ::: | ''[18]'' |STATUS_PH_WAVEFORM   | 0x00040000 | [Ricoh only] printhead waveform load request |
| ::: | ::: | ::: | ::: | ::: | ''[19]'' |STATUS_PH_TEMPERATURE  | 0x00080000 | Temperature of one PH is not ok |
| ::: | ::: | ::: | ::: | ::: | ''[20]'' |STATUS_IMAGEEND      | 0x00100000 | jetmapping - image print end event |
| ::: | ::: | ::: | ::: | ::: | ''[21]'' |STATUS_LINK_LOSS     | 0x00200000 | HIB link loss indication on one enabled ph [HIB products only] |
| ::: | ::: | ::: | ::: | ::: | ''[24]'' |STATUS_JOBQUEUEEMPTY  | 0x01000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[25]'' |STATUS_JOBTRANSFER   | 0x02000000 | -                              |
| ::: | ::: | ::: | ::: | ::: | ''[28]'' |STATUS_STEPPERMOTOR_BUSY  | 0x10000000 | [Kyocera only]                 |